﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HarveyNash.RefactoringAndCodeSmell.CodeSmell.MessageChain.Before
{
    public class Invoice
    {
        public Customer Customer { get; set; }
        public Invoice(Customer customer)
        {
            Customer = customer;
        }

        public double GetShippingCost()
        {
            if (Customer.Address.Country.IsInEurope()) 
                return 1;
            return 5.5;
        }
    }

    public class Customer
    {
        public Address Address { get; set; }
    }

    public class Address
    {
        public Country Country { get; set; }    
    }

    public class Country
    {
        public Continent Continent { get; set; }
        public bool IsInEurope()
        {
            return Continent == Continent.Europe;
        }
    }

    public enum Continent
    {
        Asia,
        Europe,
        America,
        Africa,
        Antarctica,
        Australia
    }
}
